<?php

/*
 * File  : aksi_ongkir.php
 * Table : ongkirs
 */
session_start();
//cek session

if (!$_SESSION["USRID"] AND !$_SESSION["USRPASS"]) {
    header("location: ../index.php");
    exit();
}
//end
?>

<?php

include "../../../library/fungsi.lib.php";

$module = $_GET["module"];
$opr = $_GET["opr"];


// hapus ongkos kirim
if ($module == 'ongkir' AND $opr == 'hapus') {
    mysql_query("DELETE FROM ongkirs WHERE ongkir_id='" . $_GET["id"] . "'");
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);
}

// input ongkos kirim
elseif ($module == 'ongkir' AND $opr == 'input') {
    $ongkir_kota = $_POST["in_ongkir_kota"];
    $ongkir_harga = $_POST["in_ongkir_harga"];
    $sql = "INSERT INTO ongkirs(ongkir_kota, ongkir_harga) VALUES('$ongkir_kota','$ongkir_harga')";
    //echo $sql;
    mysql_query($sql);
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);
}

// update ongkos kirim
elseif ($module == 'ongkir' AND $opr == 'update') {
    $ongkir_kota = $_POST["in_ongkir_kota"];
    $ongkir_harga = $_POST["in_ongkir_harga"];
    $ongkir_id = $_POST["id"];
    $sql = "UPDATE ongkirs SET ongkir_kota='$ongkir_kota', ongkir_harga='$ongkir_harga' WHERE ongkir_id='$ongkir_id'";
    //echo $sql;
    mysql_query($sql);
    header('location:' . URLHOST . 'cms/hansip.php?module=' . $module);
}
?>
